#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
using namespace  std;


//整体思路就是快速匹配最近的节点
int findRadius(vector<int>& houses, vector<int>& heaters) 
{
    long long changdu=0;
    int pointer1=-1;
    int pointer2=0;
    int pointer3=0;
    while(pointer3 < houses.size()){
        long long left=(pointer1 == -1)?(INT_MIN):(heaters[pointer1]);
        long long right=(pointer2 == heaters.size())?(INT_MAX):(heaters[pointer2]);
        long long zuo=left-houses[pointer3];
        long long you=right-houses[pointer3];
        long long temp=min(abs(zuo),abs(you));
        if(temp > changdu){
            changdu = temp;
        }
        if(houses[pointer3] == heaters[pointer2]){
            pointer1++;
            pointer2++;
        }
        ++pointer3;
    }
    return changdu;
}


//这个题目。。。。
string encode(string longUrl) {
    return longUrl;
}
string decode(string shortUrl) {
    return shortUrl;
}


int main()
{
    vector<int> a={1,2,3,4};
    vector<int> b={1,4};
    cout<<findRadius(a,b)<<endl;
}